package org.karelun.gef.trash;

import org.eclipse.gef.requests.CreationFactory;

/**
 * @author Karelun huang
 *
 */
public class ElementFactory implements CreationFactory {

    private Object template;

    public ElementFactory(Object template) {
        this.template = template;
    }

    public Object getNewObject() {
        try {
            return ((Class<?>) template).newInstance();
         }
         catch (Exception e) {
            return null;
         }
    }

    public Object getObjectType() {
        return template;
    }
}